<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>

	<script>
		function handleMessage(data) {
			atualizar();
		}
	</script>

	<style>
.ui-widget-content {
	border: 0px !important;
}

dt:nth-child(odd) {
background-color:#ffffff;
}
dt:nth-child(even) {
background-color:#F5F5F5;
border-top: 1px solid !important;
border-bottom: 1px solid !important;
}
.ui-datalist-item {
	padding : 10px;
}
</style>

</h:head>

<f:view>
	<h:body>
		<h:form id="lancesForm">

			<p:panel header="Nenhuma partida no momento"
				rendered="#{partidaBean.partida == null}">
				<p:outputPanel id="content"
					style="width:100%;height:200px;overflow:auto;" />

				<p:outputLabel value="Aguarde até iniciar uma nova partida..." />

			</p:panel>

			<p:panel header="Partida" rendered="#{partidaBean.partida != null}"
				style="text-align:center;">
				<p:outputPanel id="content2"
					style="width:100%;height:200px;overflow:auto;margin:0 auto;" />

				<p:outputLabel value="Campeonato #{partidaBean.partida.campeonato}"
					style="font-size: 40px;" />
				<br />
				<br />
				<p:outputLabel style="font-size: 40px;"
					value="#{partidaBean.partida.timeCasa} - #{partidaBean.partida.placarTimeCasa}  X  #{partidaBean.partida.placarTimeVisitante} - #{partidaBean.partida.timeVisitante}" />

			</p:panel>

			<br />
			<br />
			<br />

			<p:panel header="Lances" rendered="#{partidaBean.partida != null}">
				<p:outputPanel id="content3"
					style="width:100%;height:200px;overflow:auto" />


				<p:panel header="2 Tempo" rendered="#{partidaBean.numeroLancesSegundoTempo > 0}">
					<p:dataList value="#{partidaBean.partida.lancesSegundoTempo}"
						var="lancest" type="definition">  
				    #{lancest.tipo == 'Normal' ? '' : '[' } #{lancest.tipo == 'Normal' ? '' : lancest.tipo } #{lancest.tipo == 'Normal' ? '' :  ']' }
				     #{lancest.tempo}' - #{lancest.comentario}  
					</p:dataList>
				</p:panel>

				<p:panel header="1 Tempo" rendered="#{partidaBean.numeroLancesPrimeiroTempo > 0}">
					<p:dataList value="#{partidaBean.partida.lancesPrimeiroTempo}"
						var="lancept" type="definition" >  
				    #{lancept.tipo == 'Normal' ? '' : '[' } #{lancept.tipo == 'Normal' ? '' : lancept.tipo } #{lancept.tipo == 'Normal' ? '' :  ']' }
				     #{lancept.tempo}' - #{lancept.comentario}  
					</p:dataList>
				</p:panel>


			</p:panel>

			<p:remoteCommand name="atualizar" update="lancesForm" />

		</h:form>

		<p:socket onMessage="handleMessage" channel="/counter" />


	</h:body>
</f:view>
</html>